interface Position {
    x: number;
    y: number;
}

class Rectangle implements Position {
    public constructor(
        public x: number = 0.0,
        public y: number = 0.0,
        public width: number = 0.0,
        public height: number = 0.0
    ) {
    }

    public toString(): string {
        return "[object Rectangle x: " + this.x + " y: " + this.y + " width: " + this.width + " height: " + this.height + " ]";
    }

    public toFixed(): void {
        this.x = Number(this.x.toFixed(2));
        this.y = Number(this.y.toFixed(2));
        this.width = Number(this.width.toFixed(2));
        this.height = Number(this.height.toFixed(2));
    }

    public clear(): void {
        this.x = this.y = this.width = this.height = 0.0;
    }

    public copyFrom(value: this): this {
        this.x = value.x;
        this.y = value.y;
        this.width = value.width;
        this.height = value.height;

        return this;
    }

    public setTo(x: number, y: number, width: number, height: number): this {
        this.x = x;
        this.y = y;
        this.width = width;
        this.height = height;

        return this;
    }
}